<?php
// +----------------------------------------------------------------------
// | CLTPHP.Pro [基础模型]
// +----------------------------------------------------------------------
// | Copyright (c) 2019-2029 https://www.cltphp.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://www.cltphp.com/detail-140.html )
// +----------------------------------------------------------------------
// | Author: chichu <1109305987@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\model;

use think\Model;
class Base extends Model
{
    // 通用修改数据
    public static function edit($id){
        $info = self::find($id);
        return $info;
    }
    // 通用修改保存
    public static function editSave($data){
        $result = self::update($data);
        if ($result) {
            return ['code' => 0, 'msg' => '修改成功'];
        } else {
            return ['code' => 1, 'msg' => '修改失败'];
        }
    }
    // 获取列表
    public static function getList($where = array(), $page, $order = ['sort', 'id'=>'desc']){
        $list = self::where($where)->order($order)
            ->paginate($page);
        return $list;
    }

}